<?php

use App\Http\Controllers\Api\V1 as APIV1;
use Illuminate\Contracts\Routing\Registrar as RouteContract;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::get('/aaa', \App\Http\Controllers\TestController::class . '@index');
Route::get('/abc', APIV1\AbcController::class . '@index');
Route::get('/aaaa', '\App\Api\V1\TokenController@index');
$api = app('Dingo\Api\Routing\Router');

$api->version('v1', ['middleware' => ['api.throttle'], 'limit' => 50, 'expire' => 2], function ($api) {
    $api->post('getToken', '\App\Api\V1\TokenController@authenticate');
    $api->post('register', '\App\Api\Auth\RegisterController@register');
    $api->get('test', '\App\Api\Auth\RegisterController@test');
    $api->get('abc', 'App\Http\Controllers\Api\V1\AbcController@index');
    $api->get('sss', 'App\Http\Controllers\TestController@index');
    $api->get('getRaw','\App\Api\V1\TokenController@AuthenticatedUser');
    $api->group(['middleware' => 'jwt.auth'], function ($api) {
    });
});
//$api->version('v2',[ 'middleware' => 'api.throttle','limit' => 50, 'expire' => 2 ], function ($api) {
//    $api->post('login', '\App\Http\Controllers\Api\V2\Auth\LoginController@login');
//    $api->post('register', '\App\Http\Controllers\Api\V2\Auth\RegisterController@register');
//    $api->get('test', '\App\Http\Controllers\Api\V2\TestController@test');
//    $api->get('getUser', '\App\Http\Controllers\Api\V2\UserController@test');
//    $api->group(['middleware' => 'swoole'], function ($api) {
//        $api->get('swoole', '\App\Http\Controllers\Api\V2\TestController@test1');
//        $api->get('testphp', '\App\Http\Controllers\Api\V2\TestController@test2');
//    });
//});
Route::group(['prefix' => 'v1', 'middleware' => 'jwt.auth'], function (RouteContract $api) {
    $api->group(
        ['prefix' => 'payType'], function (RouteContract $api) {
        $api->get('/alipay', APIV1\PayController::class . '@index');
    });
});
//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});
